package com.example.test.controller;

import com.example.test.bean.UserBean;
import com.example.test.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

@Controller
public class LoginController {
    @Resource
    UserService userServic;
    @RequestMapping("/login")
    public String show(){
        return "login";
    }
    @RequestMapping(value = "/login",method = RequestMethod.POST)
    public String login(String name,String password){
    UserBean userBean=userServic.loginIn(name,password);
        if (userBean != null) {
            return "success";
        } else {
            return "error";
        }
    }

}
